package com.itheima.exam.config;

import com.itheima.exam.exception.UserException;
import com.itheima.exam.web.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class StudentExceptionHandler {

    @ExceptionHandler(UserException.class)
    public Result handleEx(UserException ex){
        return Result.ERR(ex.getMessage());
    }
}
